<script setup>
import { ref, defineOptions } from 'vue'
import { readRecommend } from '@/api/getAxios'

//读者推荐
const readrecommend = ref({})
readRecommend().then((res) => {
    // console.log(res);
    readrecommend.value = res.data.data.list
})

</script>
<template>
    <div class="read-recommend">
        <h1 class="recommend">
            <span>读者推荐</span>
        </h1>
        <ul>
            <li v-for="item in readrecommend" @click="$router.push(`/BookInfo?storyId=${item.storyId}`)">
                <div class="img">
                    <img :src="item.storyCover" alt="" class="storyCover">
                    <div class="mask">
                        <img :src="item.faceAddress" alt="" class="faceAddress">
                    </div>
                </div>

                <div class="info">
                    <div class="name">{{ item.storyName }}</div>
                    <div class="author-type">{{ item.storyAuthor }} | {{ item.storyType }}</div>
                    <p class="nickname">{{ item.nickname }}</p>
                    <p class="recentReadChapterName">最近在读：{{ item.recentReadChapterName }}</p>
                </div>
            </li>
        </ul>
    </div>
</template>

<style scoped lang='less'>
.read-recommend {
    height: 70vw;
    background-color: #fff;
    margin-bottom: 15px;

    h1 {
        text-align: center;
        font-weight: bold;
        font-size: 22px;
        padding: 20px 0px;
        position: relative;

        span.jump {
            position: absolute;
            right: 0;
            font-size: 26px;
            margin-right: 20px;
        }
    }

    ul {
        display: flex;
        overflow-x: auto;
        height: 45vw;
        width: 95vw;
        margin: 0 auto;

        &::-webkit-scrollbar {
            display: none;
        }

        li {

            border-radius: 5px;
            border: 1px solid #eee;
            display: flex;
            width: 80vw;
            height: 40vw;
            padding-right: 20px;
            margin-right: 10px;

            .img {
                width: 30vw;
                height: 100%;
                position: relative;
                border-radius: 5px;

                .storyCover {
                    width: 30vw;
                    height: 100%;
                    border-radius: 5px;

                }

                .mask {
                    padding: 0 3px;
                    border-radius: 50%;
                    background-color: #fff;
                    position: absolute;
                    top: 50%;
                    margin-top: -15px;
                    border-radius: 50%;
                    right: -15px;
                }

                .faceAddress {
                    border-radius: 50%;
                    width: 30px;
                    height: 30px;
                }
            }

            .info {
                display: flex;
                flex-direction: column;
                justify-content: space-evenly;
                width: 70vw;
                margin-left: 20px;

                .name {
                    font-size: 18px;
                }

                .author-type {
                    font-size: 14px;
                    color: #9e9da1;
                }

                .nickname {
                    font-size: 14px;
                    color: #9e9da1;
                }

                .recentReadChapterName {
                    font-size: 14px;
                    color: #9e9da1;

                }
            }

        }
    }
}</style>